package com.kangfu.common.utils;

import java.math.BigDecimal;

public class CaculateUtils {

    public static BigDecimal DoubleAddDoube(Double a, Double b) {
        BigDecimal aa = new BigDecimal(a.toString());
        return aa.add(new BigDecimal(b.toString()));
    }

    public static BigDecimal BigDecimalAddDouble(BigDecimal a, Double b) {
        return a.add(new BigDecimal(b.toString()));
    }


    public static BigDecimal m2km(Double a) {
        return (new BigDecimal(Double.toString(a))).divide(new BigDecimal("1000"),2,BigDecimal.ROUND_HALF_UP);
    }

    public static BigDecimal m2km(BigDecimal a) {
        return a.divide(new BigDecimal("1000"),2,BigDecimal.ROUND_HALF_UP);
    }


    public static BigDecimal intDevideInt(int a, int b) {
        return (new BigDecimal(a)).divide(new BigDecimal(b),2,BigDecimal.ROUND_HALF_UP);
    }
}
